using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class UITabContainer : UICan<UIViewor>
{
	override protected List<UIViewor> getComponentSort ()
	{
		return GameObjectUtils.getChildrenGameObjectComponentSort<UIViewor> (gameObject);
	}

	override protected void initComponent (UIViewor viewor)
	{
		GameObjectUtils.getGameObjectComponent<UIRetain> (viewor.gameObject).retain ();
	}

	override protected bool isComponentActive (UIViewor component)
	{
		if (component.gameObject.transform.parent != null) {
			if (component.gameObject.activeSelf) {
				return true;
			}
			
			component.gameObject.SetActive (true);
			setComponentActive (component, false);
		}

		return false;
	}
	
	override protected void setComponentActive (UIViewor component, bool status)
	{
		if (status) {
			VieworUtils.doAppear (component, gameObject.transform);
			
		} else {
			VieworUtils.doDisappear (component);
		}
	}
}
